import {createRouter, createWebHistory} from 'vue-router'
import Layout from "@/layout/Layout";

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: Layout,
        redirect: "/books",
        children: [
            {
                path: 'books',
                name: 'Books',
                component: () => import("@/views/Books"),
            }, {
                path: 'news',
                name: 'News',
                component: () => import("@/views/News"),
            },
            {
                path: 'users',
                name: 'Users',
                component: () => import("@/views/Users"),
            },
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import("../views/Login")
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import("../views/Register")
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
